package com.test5;

import java.io.FileInputStream;
import java.io.InputStreamReader;

public class InputStreamReaderTest {
    public static void main(String[] args) throws Exception {
        //创建InputStreamReader
        FileInputStream fis = new FileInputStream("C:\\Users\\LDH\\Desktop\\test.txt");
        InputStreamReader isr = new InputStreamReader(fis,"utf-8");
        //读取文件
        int data = 0;
        while ((data = isr.read()) != -1){
            System.out.print((char) data);
        }
        //关闭
        isr.close();
    }
}
